<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- 微软的老式浏览器 -->
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <!-- 显示窗口 宽度 是 客户端的 屏幕 宽度 （就是 满屏 ！），显示的文字和图形的初始比例 是 1.0 -->
    <link rel="stylesheet" href="css/layui.mobile.css">
    <link rel="stylesheet" type="text/css" href="css/att.css">
    <script src="js/common.js"></script>
    <title>工作证认证</title>
</head>
<body style="background-color: #fff;">
	<div class="hitop">
		<div class="tubiao"><img src="images/img/123.png" alt=""></div>
                <div class="lione"><a href="" style="color:#000;">工作认证</a>/<a href="Email-authentication.html">邮箱认证</a>/<a href="mp-authentication.html">名片</a></div>
        <div class="bigk">
            <div class="kuang">
                <div id="list"></div>
                <div class="addbox" id="upload-btn"></div>
                <p>请上传工作证明（可以上传多个证明哦）~</p>
            </div>
        </div>
        <div class="quetwo"><a  class="oktwo" onclick="rz()">提交审核</a></div>
    </div>
    <input style="display: none" type="file" id="file" accept="image/png,image/gif,image/jpeg,image/jpg">
    <script type="text/javascript" src="js/jquery/jquery.min.js"></script>
    <script src="js/jquery/upload.js"></script>
    <script src="js/jquery/layer.js"></script>
    <script src="js/utils.js"></script>
    <script>
        Utils.historyBack(function () {
            window.location.href = '/certification.html';
        });
        var img=[];
        new Upload({
            button :"#upload-btn",
            file : '#file',
            module : 'album',
            success : function (url) {
                //$(".kuang").html("");
                img.push(url);
                var strs=`<img src=${url}>`;
                $(strs).appendTo("#list");
            },
            error : function (data) {
                alert('网络错误');
            }
        });
        function rz() {
            if(img.length===0){
                layer.open({
                    content: '请上传证件',
                    time: 1,
                    skin:'msg'
                });
                return false
            }
            $.ajax({
                type : "POST",
                url : getRequestUrl("/user/upload_auth_data"),
                data:{
                    auth_type:4,
                    data:img.toString()
                },
                success : function(datas) {
                    console.log(datas);
                    if(datas.response_params.result==0){
                        layer.open({
                            content: '工作证上传成功,等待系统审核',
                            time: 2,
                            skin:'msg'
                        });
                        setTimeout(function () {
                            history.go(-1)
                        },2000)
                    }
                },
                error : function(err) {
                	dealCPErrorResponse(err);
                }
            });
        }
    </script>
</body>
</html>